<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>我的客户主界面</title>
		<script type="text/javascript">
			//分页查询
			function skipPage(currentPage){
        		var url='${pageContext.request.contextPath }/customerOrder.action?method=queryCustomerOrder&currPage='+currentPage;
        		window.location.href=url;
      		}
      		//添加客户订单
      		function addCustomerOrder(){
      			var url='${pageContext.request.contextPath }/luhong/customer/customerOrder/addOrder.jsp';
      			window.location.href=url;
      		}
      		//删除客户订单
      		function del(id,status){
      			if(status=='1'){
      				alert("已是接单状态,不能删除");
      				return;
      			}
      			if(confirm("您确定要删除吗？")){
      				var url='${pageContext.request.contextPath }/customerOrder.action?method=delCustomerOrderById&cusoid='+id;
      				window.location.href=url;
      			}
      		}
      		var oldColor;
			function choice(trObj) {
				oldColor = trObj.bgColor;
				trObj.bgColor = "yellow";
			}
			function leave(trObj) {
				trObj.bgColor = oldColor;
			}
    </script>
	<style type="text/css">
		a {
			cursor: pointer;
		}
		body {
			background-image:
			url(${pageContext.request.contextPath}/images/forum7.jpg);
		}
	</style>
	</head>

	<body>
		<form
			action="${pageContext.request.contextPath}/customerOrder.action?method=queryCustomerOrder"
			method="post">
			订单编号:
			<input type="text" name="oid" id="oid"
				value="${requestScope.orderID}">
			客户编号:
			<input type="text" name="cid" id="cid"
				value="${requestScope.orderCusID}">
			接单状态(1接单0未接单):
			<input type="text" name="status" id="status"
				value="${requestScope.orderStatus}">
			<input type="submit" value="查找">
			<br/><br/>
			<center>
				<button type="button" onclick="addCustomerOrder();">
					添加客户订单
				</button>
			</center>
			<br/>
			<div style="height: 320px;">
				<table align="center" border="1px" cellspacing="0px"
					cellpadding="0px">
					<tr>
						<td>
							订单编号
						</td>
						<td>
							客户
						</td>
						<td>
							订单时间
						</td>
						<td>
							订单详情
						</td>
						<td>
							项目名称
						</td>
						<td>
							订单报价
						</td>
						<td>
							接单状态(1接单0未接单)
						</td>
						<td>
							操作
						</td>
					</tr>
					<c:forEach items="${requestScope.cusorderpage.orderdata}"
						var="view" varStatus="c">
						<tr bgcolor="${c.index%2==0?'white':'skyblue'}"
							onmouseover=choice(this); onmouseout=leave(this);>
							<td>
								${view.orderId }
							</td>
							<td>
								${view.cusName }(${view.cusId })
							</td>
							<td>
								${view.orderTime }
							</td>
							<td>
								<a
									href="${pageContext.request.contextPath}/file/file_finance/${view.orderTextAddr }">${view.orderText
									}</a>
							</td>
							<td>
								${view.proName }
							</td>
							<td>
								${view.orderCash }
							</td>
							<td>
								<c:if test="${view.orderStatus=='0'}">
   	 								<font color='red'><strong>未接单</strong></font>
   	 							</c:if>
   	 							<c:if test="${view.orderStatus=='1'}">
   	 								已接单
   	 							</c:if>	
							</td>
							<td>
								<a onclick="del('${view.orderId }','${view.orderStatus }');">删除</a>
							</td>
						</tr>
					</c:forEach>
				</table>
			</div>
			<table align="center">
				<tr>
					<td>
						<a onclick=
	skipPage('1');
;>首页</a>
					</td>
					<td>
						<a
							onclick="skipPage('${requestScope.cusorderpage.currentPage==1?1:requestScope.cusorderpage.currentPage-1 }');">上一页</a>
					</td>
					<td>
						<a
							onclick="skipPage('${requestScope.cusorderpage.currentPage==requestScope.cusorderpage.totalPage?(requestScope.cusorderpage.currentPage):(requestScope.cusorderpage.currentPage+1) }');">下一页</a>
					</td>
					<td>
						<a onclick="skipPage('${requestScope.cusorderpage.totalPage}');">末页</a>
					</td>
					<td>
						当前页码：${requestScope.cusorderpage.currentPage}/${requestScope.cusorderpage.totalPage}
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
